/**
 * hideTab {boolean}: 是否在顶部tabs中隐藏此路由组件的tab项, 默认为 false - 不隐藏
 * keepAlive: 是否缓存此路由组件, 默认为 false - 不缓存
 */

import {RouteRecordRaw} from 'vue-router'
import layout from '/@/layout/index.vue'
import redirect from '/@/views/redirect.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('/@/views/login.vue'),
    meta: {
      hideTab: true,
    },
  },

  {
    path: '/',
    name: 'Main',
    component: layout,
    redirect: '/home',
    children: [
      {
        path: '/redirect',
        name: 'Redirect',
        component: redirect,
        meta: {
          hideTab: true,
        },
      },
      {
        path: '/home',
        name: 'Home',
        component: () => import('/@/views/home.vue'),
        meta: {
          title: '首页',
          keepAlive: true,
        },
      },
      {
        path: '/about',
        name: 'About',
        component: () => import('/@/views/about.vue'),
        meta: {
          title: '关于',
        },
      },
      {
        path: '/table',
        name: 'Table',
        component: () => import('/@/views/table.vue'),
        meta: {
          title: '表格',
          keepAlive: true,
        },
      },
      {
        path: '/table1',
        name: 'Table1',
        component: () => import('/@/views/table1.vue'),
        meta: {
          title: '表格1',
          keepAlive: true,
        },
      },
      {
        path: '/fundDetail/:fundCode',
        name: 'fundDetail',
        component: () => import('/@/views/fundDetail.vue'),
        meta: {
          title: '详情',
          keepAlive: true,
        },
      },
    ]
  },

  {
    path: '/openLayers',
    name: 'Open Layers',
    component: layout,
    redirect: '/openLayers/test',
    children: [
      {
        path: '/openLayers/test',
        name: 'Test1',
        component: () => import('/@/views/openLayers/test.vue'),
        meta: {
          title: '测试',
          keepAlive: true,
        },
      },
      {
        path: '/openLayers/heatmap',
        name: 'heatmap',
        component: () => import('/@/views/openLayers/heatmap.vue'),
        meta: {
          title: '测试',
          keepAlive: true,
        },
      },
      {
        path: '/openLayers/drilling',
        name: 'drilling',
        component: () => import('/@/views/openLayers/drilling.vue'),
        meta: {
          title: '地图下钻',
          keepAlive: true,
        },
      },
      {
        path: '/openLayers/cluster',
        name: 'cluster',
        component: () => import('/@/views/openLayers/cluster.vue'),
        meta: {
          title: '数据聚合',
          keepAlive: true,
        },
      },
      {
        path: '/openLayers/blingbling',
        name: 'blingbling',
        component: () => import('/@/views/openLayers/blingbling.vue'),
        meta: {
          title: '闪烁',
          keepAlive: true,
        },
      },
      {
        path: '/openLayers/highlight',
        name: 'highlight',
        component: () => import('/@/views/openLayers/highlight.vue'),
        meta: {
          title: '光标悬浮高亮区域',
          keepAlive: true,
        },
      },
    ],
  },

  {
    path: '/demos',
    name: 'Demos',
    component: layout,
    redirect: '/demos/test',
    children: [
      {
        path: '/demos/test',
        name: 'Test',
        component: () => import('/@/views/demos/test.vue'),
        meta: {
          title: '测试',
          keepAlive: true,
        },
      },
    ],
  },

  {
    path: "/error",
    name: "error",
    component: layout,
    redirect: "/error/401",
    children: [
      {
        path: "/error/401",
        name: "401",
        component: () => import("/@/views/error/401.vue"),
        meta: {
          title: "401",
        }
      },
      {
        path: "/error/404",
        name: "404",
        component: () => import("/@/views/error/404.vue"),
        meta: {
          title: "404",
        }
      }
    ]
  },

  {
    path: "/:pathMatch(.*)",
    redirect: "/error/404"
  },
]

export default routes
